home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Console Thyself / ConsoleAdder / ConsoleAdder.cs next >
Encoding:
Text File  |  2001-01-15  |  671 b   |  25 lines

  1. //-------------------------------------------
  2. // ConsoleAdder.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------
  4. using System;
  5.  
  6. class ConsoleAdder
  7. {
  8.      public static void Main()
  9.      {
  10.           int a = 1509;
  11.           int b = 744;
  12.           int c = a + b;
  13.  
  14.           Console.Write("The sum of ");
  15.           Console.Write(a);
  16.           Console.Write(" and ");
  17.           Console.Write(b);
  18.           Console.Write(" equals ");
  19.           Console.WriteLine(c);
  20.  
  21.           Console.WriteLine("The sum of " + a + " and " + b + " equals " + c);
  22.  
  23.           Console.WriteLine("The sum of {0} and {1} equals {2}", a, b, c);
  24.      }
  25. }